<?php
// +----------------------------------------------------------------------
// | 小牛Admin
// +----------------------------------------------------------------------
// | Website: www.xnadmin.cn
// +----------------------------------------------------------------------
// | Author: dav <85168163@qq.com>
// +----------------------------------------------------------------------

namespace app\common\model;

use think\Model;
use utils\Data;

class PageModel extends Model
{

    protected $name = 'page';

    /**
     * 获取树形分类数据
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getTreeList()
    {
        $list = self::order('sort asc, id asc')->select()->toArray();
        $list = Data::tree($list, 'title','id');
        return $list;
    }
}